﻿#pragma once

#ifndef QCEFSTRRESFILTER_H
#define QCEFSTRRESFILTER_H

#include "QCefHeader.h"
#include "QCefDebug.h"
#include "QCefWidget.h"
#include "QCefUtil.h"

class QCefStrResFilter : public CefResponseFilter
{
public:
    QCefStrResFilter(QCefWidget * opr, const QString & strKey, const QString & strMethod, const QString & strUrl, int iResourceType);
    virtual ~QCefStrResFilter();

public:
    virtual bool InitFilter() override;

    virtual CefResponseFilter::FilterStatus Filter(void* data_in,
        size_t data_in_size,
        size_t& data_in_read,
        void* data_out,
        size_t data_out_size,
        size_t& data_out_written) override;

protected:
    QCefWidget *        m_operator;
    QString             m_key;
    QString             m_method;
    QString             m_url;
    int                 m_resourceType;
    QByteArray          m_data;

private:
    IMPLEMENT_REFCOUNTING(QCefStrResFilter);
    DISALLOW_COPY_AND_ASSIGN(QCefStrResFilter);
};



#endif // QCEFSTRRESFILTER_H
